<# # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script is designed To fetch the OS installation date. # Configuration Type - COMPUTER # Refer: https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem #> # Get the current date $currentDate = Get-Date # Retrieve the OS installation date and OS details $osInfo = Get-WmiObject Win32_OperatingSystem # Convert the installation date to a DateTime object $installDate = [System.Management.ManagementDateTimeConverter]::ToDateTime($osInfo.InstallDate) # Calculate the time difference in days $daysInstalled = ($currentDate - $installDate).Days # Display OS details, installation date, and the number of days installed "OS Name: $($osInfo.Caption)" "OS Version: $($osInfo.Version)" "OS Architecture: $($osInfo.OSArchitecture)" "Installation Date: $installDate" "Days Installed: $daysInstalled"